#include <iostream>

class Random{
public:

    Random(const Random&) = delete;
    Random operator=(const Random& ) = delete;
     
    static Random& Get()
    {
        static Random instance;
        return instance;
    }

    void Function() {}
    
    //静态方法可以被单例对象直接调用
    static float Float()
    {
       return Get().FloatImpl();
    }
private:
    Random() {}
    float FloatImpl() { return m_RandomGenerator; } 
    float m_RandomGenerator = 0.5f;
};

int main()
{
#if 0
    //Random instance = Random::Get(); //调用拷贝构造函数
    Random& instance = Random::Get();  
    //auto& instatnce = Random::Get();
    instance.Function();
#else
    float number = Random::Float();
    std::cout << number << std::endl;

#endif   
}

